package com.ioc.controller;

import com.ioc.service.UserService;
import com.ioc.service.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class UserController {

    public UserController() {
        System.out.println("UserController...构造函数");
    }

    @Autowired
    UserService userService;

    public void setUserService(UserService userService) {
        this.userService = userService;
    }

    public void all(){
        System.out.println("controller...all");
        List<String> names = userService.getNames();
        for (String name : names){
            System.out.println(name);
        }
    }
}
